<script>
function checkform(){
	commonEffection.setLoading();
	$('#addFeatureForm').submit();
}
	upload.type='images';
	upload.formid='addFeatureForm';
	upload.setAppend=function(imgurl){
		return '<div style="margin:10px"><a href="'+imgurl+'" target="_blank"><img style="height:100px;width:100px;vertical-align:middle;border:1px #cccccc dashed" src="'+imgurl+'" /></a> 链接地址:<input type="text" name="imgHref[]" value="" /> 标题:<input type="text" name="captionText[]" value="<?=$this->imgArray['captionText'][$i]?>" />描述:<input type="text" name="captionText2[]" value="<?=$this->imgArray['captionText2'][$i]?>" /> <input type="hidden" name="imgUrl[]" value="'+imgurl+'" /><input type="hidden" name="linkType[]" value="URL" /><input type="hidden" name="linkTarget[]" value="_blank" /><input type="hidden" name="enableButtonWhenInFront[]" value="1" />　<input type="button" value="删除" onclick="upload.delimg(this);" /></div>';
	}
	
	fenleiEffection.type='feature';
	fenleiEffection.optionString='请选择栏目分类';
</script>
<div class="frame_addfactoryDiv">
  <form name="addFeatureForm" id="addFeatureForm" enctype="multipart/form-data"  action="administrator-topimage-doedit" method="post">
  <table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#c8d9e9">
	<tr>
	  <td class="ri-bbgg"><span class="red">*</span> 上传图片：</td>
	  <td class="le"><span><input name="productpic" type="file" id="productpic" /></span>　<input type="button" onclick="uploadImg(this);" id="uploadButton" value="上传" /><input type="button" onclick="uploadImg2();" value="上传并置顶" /></td>
	</tr>
	<tr>
	  <td class="ri-bbgg">图片效果：</td>
	  <td class="le">
		<div id="productImages">
		<?for($i=0;$i<count($this->imgArray['imgUrl']);$i++):?>
			<div style="margin:10px" id="div<?=$i?>"><a href="<?=$this->imgArray['imgUrl'][$i]?>" target="_blank"><img style="height:100px;width:100px;vertical-align:middle;border:1px #cccccc dashed" src="<?=$this->imgArray['imgUrl'][$i]?>" /></a> 链接地址:<input type="text" name="imgHref[]" value="<?=$this->imgArray['imgHref'][$i]?>" /> 标题:<input type="text" name="captionText[]" value="<?=$this->imgArray['captionText'][$i]?>" />描述:<input type="text" name="captionText2[]" value="<?=$this->imgArray['captionText2'][$i]?>" /> <input type="hidden" name="nochange[]" value="1" /> <input type="hidden" name="imgUrl[]" value="<?=$this->imgArray['imgUrl'][$i]?>" /><input type="hidden" name="linkType[]" value="<?=$this->imgArray['linkType'][$i]?>" /><input type="hidden" name="linkTarget[]" value="<?=$this->imgArray['linkTarget'][$i]?>" /><input type="hidden" name="enableButtonWhenInFront[]" value="<?=$this->imgArray['enableButtonWhenInFront'][$i]?>" />　<input type="button" value="删除" onclick="upload.delimg(this);" /></div>
		<?endfor;?>
		</div>
		<iframe id="productIframe" width="0" height="0" name="productIframe"></iframe>
	  </td>
	</tr>
    <tr>
      <td colspan="2" class="se" align="center">
        <input name="button2" type="button" class="iput" value="保 存"   onclick="checkform();" />　　
        <input name="button" type="button" class="iput" value="返 回" onclick="commonEffection.confirmBack();" />
      </td>
    </tr>
  </table>
</div>
<script>
function uploadImg(thisInput){
      upload.setImg=function(imgurl){
               this.imgurl=imgurl;
		$('#productImages').append(this.setAppend(imgurl));
		parent.shutMsg();
		commonEffection.resetFrame('admins_frame',true);
	}
	upload.uploadimg(thisInput);
}

function uploadImg2(thisInput){
  
  var uploadButton = document.getElementById("uploadButton");
	upload.setImg=function(imgurl){
               this.imgurl=imgurl;
		$('#div0').before(this.setAppend(imgurl));
		parent.shutMsg();
		commonEffection.resetFrame('admins_frame',true);
	}
	upload.uploadimg(uploadButton);
}
</script>
